{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Transmission Line Properties"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "\n",
    "import skrf as rf\n",
    "\n",
    "%matplotlib inline\n",
    "\n",
    "from skrf import Frequency\n",
    "from skrf.media import DistributedCircuit\n",
    "\n",
    "rf.stylely()\n",
    "\n",
    "# define a frequency object\n",
    "freq = Frequency.from_f(np.logspace(0,6,101), unit='Hz')\n",
    "\n",
    "def func(C=93,I=273, R=0, G=0):\n",
    "    coax = DistributedCircuit(frequency = freq,\n",
    "                              C =C*1e-12,#F/m\n",
    "                              I =I*1e-9,  #H/m\n",
    "                              R =10**(-R),#53e-3,   #Ohm/m\n",
    "                              G =G,       #S/m\n",
    "                              )\n",
    "    freq.plot(coax.gamma.imag,label=r'$ \\beta$')\n",
    "    freq.plot(coax.gamma.real, label=r'$ \\alpha$')\n",
    "    plt.ylabel('Propagation Constant (rad/m)')\n",
    "    plt.ylim(1e-8,1e2)\n",
    "    plt.loglog()# impose log-log scaling\n",
    "    plt.legend()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from ipywidgets import interact\n",
    "\n",
    "interact(func, C=(0,100,10), I=(100,400,10), R =(0,10),G=(0,10));"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
